<template>
  <div class="wraps">
    <el-form ref="addRForm" :model="form" class="form" label-position="top">
      <el-form-item label="联系人姓名">
        <el-input v-model="form['联系人']" placeholder="请输入联系人姓名"/>
      </el-form-item>
      <el-form-item label="电话">
        <el-input v-model="form['电话']" placeholder="请输入联系人电话"/>
      </el-form-item>

      <el-form-item label="手机号">
        <el-input v-model="form['手机']" placeholder="请输入联系人手机号"/>
      </el-form-item>

      <el-form-item label="收款单位">
        <el-input v-model="form['收款单位']" placeholder="请输入联系人手机号"/>
      </el-form-item>

      <el-form-item label="收款账号">
        <el-input v-model="form['收款账号']" placeholder="请输入联系人手机号"/>
      </el-form-item>

      <el-form-item label="收款银行">
        <el-input v-model="form['收款银行']" placeholder="请输入联系人手机号"/>
      </el-form-item>

      <el-form-item label="Email">
        <el-input v-model="form['Email']" placeholder="请输入联系人Email"/>
      </el-form-item>

      <el-form-item label="QQ">
        <el-input v-model="form['QQ']" placeholder="请输入联系人QQ号"/>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="submit()">保存</el-button>
      </el-form-item>
    </el-form>

  </div>
</template>
<script>
import { fetchList } from '@/api/api'

export default {
  data() {
    return {
      form: {
      }
    }
  }, created() {
    this.getInfo()
  },
  methods: {
    getInfo() {
      const param = {
        query: 'vue_供货商信息', 供货商编号: localStorage.ghusername
      }
      fetchList(param).then(({ data }) => {
        data = JSON.parse(JSON.stringify(data).replace(/<null>/g, ''))
        this.form = data.data[0]
        console.log(this.form)
      })
    },
    submit() {
      const param = this.form
      param.query = 'vue_修改供货商信息'
      param.供货商编号 = localStorage.ghusername
      fetchList(param).then(({ data }) => {
        if (data.flag === '1') {
          this.$message({ message: '更新成功', type: 'success' })
          this.getInfo()
        }
      })
    }
  }
}
</script>

<style scoped>

  .wraps {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
  }
  .form {
    margin-top: 50px;
    width: 25%
  }

  .filter-wraps {
    flex-direction: column;
    display: flex;
    box-shadow: 0 0 15px #D0D2E3;
    border-radius: 2px;
    background: white;
    width: 100%;
    height: 660px;
    margin-bottom: 18px;

  }
  .filter-wraps h4{
    text-align: center;
    color: #336633;
    border-bottom: #EFEFF7 solid 1px;
    line-height: 42px;
    margin: 0;
  }
  .filter-wraps p{
    font-size: 12px;
    padding: 0 10px;
    line-height: 24px;
    color: #336633;
  }

  .filter-wraps .el-form-item {
    margin-top: 16px;
    margin-bottom: 0px;
  }
  .w80{
    width: 50%;
  }
  .bg{
    background: #336633;
  }
</style>
